package 基础篇.线程池;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * Created by Administrator on 2018/7/29 0029.
 */
public class FixedThreadPoolDemo {
    public static void main(String[] args) {
        ExecutorService pool= Executors.newFixedThreadPool(1);
        Runnable r=new A();
        pool.submit(r);
        pool.submit(r);
        pool.submit(r);
        pool.shutdown();
    }
}

class A implements Runnable{
    @Override
    public void run() {
        for(int i=0;i<100;i++){
            System.out.println(Thread.currentThread().getName()+" "+i);
        }
    }
}
